﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Experimental8.Infrastructure.Helpers;

namespace Experimental8.Modules.CommonDictionaries
{
    /// <summary>
    /// Interaction logic for ContractorsView.xaml
    /// </summary>
    //Change. Изменить на интерфейс
    [Export(typeof(ContractorsView))]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public partial class ContractorsView : UserControl
    {
        public ContractorsView()
        {
            InitializeComponent();
        }

        [Import]
        public ContractorsViewModel ViewModel
        {
            //Change. Изменить на интерфейс
            get { return this.DataContext as ContractorsViewModel; }
            set { this.DataContext = value; }
        }

        private void DataGrid_AutoGeneratingColumn_1(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            //Change. Изменить на интерфейс
            ContractorsViewModel viewmodel = this.DataContext as ContractorsViewModel;
            UIBuilderHelpers.MakeDataGridColumnByBDInfo(e, viewmodel.Contractor_Fields_Information); 
        }
    }
}
